package com.yikome.purchase.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.yikome.common.CommonRepository;
import com.yikome.purchase.entity.PurchaseLogistics;

@Repository
public interface PurchaseLogisticsRepository extends CommonRepository<PurchaseLogistics, Long> {

	@Query("select t from PurchaseLogistics t where t.yn = 1 and t.purchaseCode = :purchaseCode")
	List<PurchaseLogistics> findPurchaseLogistics(@Param("purchaseCode")String purchaseCode);
	
	@Query("select t from PurchaseLogistics t where t.yn = 1 and t.logisticCode = :logisticCode")
	PurchaseLogistics findPurchaseLogisticsWithLogisticCode(@Param("logisticCode")String logisticCode);
	
	@Query("select t from PurchaseLogistics t where t.yn = 1 and t.purchaseCode = :purchaseCode and t.logisticCode = :logisticCode")
	PurchaseLogistics findPurchaseLogistics(@Param("purchaseCode")String purchaseCode , @Param("logisticCode")String logisticCode);

}
